<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.5"/>
<title>Theron: Theron::Actor Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">Theron
   &#160;<span id="projectnumber">6.00.02</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.5 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Namespaces</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(10)"><span class="SelectionMark">&#160;</span>Pages</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="namespaceTheron.html">Theron</a></li><li class="navelem"><a class="el" href="classTheron_1_1Actor.html">Actor</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pro-methods">Protected Member Functions</a> &#124;
<a href="classTheron_1_1Actor-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Theron::Actor Class Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>The actor baseclass.  
 <a href="classTheron_1_1Actor.html#details">More...</a></p>

<p><code>#include &lt;Actor.h&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:a87c458ad24c3429da325ea6f207267f4"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTheron_1_1Actor_a87c458ad24c3429da325ea6f207267f4.html#a87c458ad24c3429da325ea6f207267f4">Actor</a> (<a class="el" href="classTheron_1_1Framework.html">Framework</a> &amp;framework, const char *const name=0)</td></tr>
<tr class="memdesc:a87c458ad24c3429da325ea6f207267f4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Explicit constructor.  <a href="#a87c458ad24c3429da325ea6f207267f4">More...</a><br/></td></tr>
<tr class="separator:a87c458ad24c3429da325ea6f207267f4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a95ce244d6cd6f4f3bfaea29dfb89ab6c"><td class="memItemLeft" align="right" valign="top">virtual&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTheron_1_1Actor_a95ce244d6cd6f4f3bfaea29dfb89ab6c.html#a95ce244d6cd6f4f3bfaea29dfb89ab6c">~Actor</a> ()</td></tr>
<tr class="memdesc:a95ce244d6cd6f4f3bfaea29dfb89ab6c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Baseclass virtual destructor.  <a href="#a95ce244d6cd6f4f3bfaea29dfb89ab6c">More...</a><br/></td></tr>
<tr class="separator:a95ce244d6cd6f4f3bfaea29dfb89ab6c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a268613b27d2d718b55e2eb489118aa04"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classTheron_1_1Address.html">Address</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTheron_1_1Actor_a268613b27d2d718b55e2eb489118aa04.html#a268613b27d2d718b55e2eb489118aa04">GetAddress</a> () const </td></tr>
<tr class="memdesc:a268613b27d2d718b55e2eb489118aa04"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the unique address of the actor.  <a href="#a268613b27d2d718b55e2eb489118aa04">More...</a><br/></td></tr>
<tr class="separator:a268613b27d2d718b55e2eb489118aa04"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afe30f86e99ff80691ec11e207711a46a"><td class="memItemLeft" align="right" valign="top"><a class="el" href="classTheron_1_1Framework.html">Framework</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTheron_1_1Actor_afe30f86e99ff80691ec11e207711a46a.html#afe30f86e99ff80691ec11e207711a46a">GetFramework</a> () const </td></tr>
<tr class="memdesc:afe30f86e99ff80691ec11e207711a46a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns a reference to the framework that owns the actor.  <a href="#afe30f86e99ff80691ec11e207711a46a">More...</a><br/></td></tr>
<tr class="separator:afe30f86e99ff80691ec11e207711a46a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4f6af5dba4b36bbb55ee216589ccfb63"><td class="memItemLeft" align="right" valign="top"><a class="el" href="namespaceTheron_a254da7d1d07833b997828500fbf73daa.html#a254da7d1d07833b997828500fbf73daa">uint32_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classTheron_1_1Actor_a4f6af5dba4b36bbb55ee216589ccfb63.html#a4f6af5dba4b36bbb55ee216589ccfb63">GetNumQueuedMessages</a> () const </td></tr>
<tr class="memdesc:a4f6af5dba4b36bbb55ee216589ccfb63"><td class="mdescLeft">&#160;</td><td class="mdescRight">Gets the number of messages queued at this actor, awaiting processing.  <a href="#a4f6af5dba4b36bbb55ee216589ccfb63">More...</a><br/></td></tr>
<tr class="separator:a4f6af5dba4b36bbb55ee216589ccfb63"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pro-methods"></a>
Protected Member Functions</h2></td></tr>
<tr class="memitem:a8d5ef774be6470b8a1e8159f93aac07a"><td class="memTemplParams" colspan="2">template&lt;class ActorType , class ValueType &gt; </td></tr>
<tr class="memitem:a8d5ef774be6470b8a1e8159f93aac07a"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classTheron_1_1Actor_a8d5ef774be6470b8a1e8159f93aac07a.html#a8d5ef774be6470b8a1e8159f93aac07a">RegisterHandler</a> (ActorType *const actor, void(ActorType::*handler)(const ValueType &amp;message, const <a class="el" href="classTheron_1_1Address.html">Address</a> from))</td></tr>
<tr class="memdesc:a8d5ef774be6470b8a1e8159f93aac07a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Registers a handler for a specific message type.  <a href="#a8d5ef774be6470b8a1e8159f93aac07a">More...</a><br/></td></tr>
<tr class="separator:a8d5ef774be6470b8a1e8159f93aac07a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3da98155747d33d767fe12b8b8c13aac"><td class="memTemplParams" colspan="2">template&lt;class ActorType , class ValueType &gt; </td></tr>
<tr class="memitem:a3da98155747d33d767fe12b8b8c13aac"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classTheron_1_1Actor_a3da98155747d33d767fe12b8b8c13aac.html#a3da98155747d33d767fe12b8b8c13aac">DeregisterHandler</a> (ActorType *const actor, void(ActorType::*handler)(const ValueType &amp;message, const <a class="el" href="classTheron_1_1Address.html">Address</a> from))</td></tr>
<tr class="memdesc:a3da98155747d33d767fe12b8b8c13aac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deregisters a previously registered message handler.  <a href="#a3da98155747d33d767fe12b8b8c13aac">More...</a><br/></td></tr>
<tr class="separator:a3da98155747d33d767fe12b8b8c13aac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8b85886531b76f0e6aa9b46004ff6bb0"><td class="memTemplParams" colspan="2">template&lt;class ActorType , class ValueType &gt; </td></tr>
<tr class="memitem:a8b85886531b76f0e6aa9b46004ff6bb0"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classTheron_1_1Actor_a8b85886531b76f0e6aa9b46004ff6bb0.html#a8b85886531b76f0e6aa9b46004ff6bb0">IsHandlerRegistered</a> (ActorType *const actor, void(ActorType::*handler)(const ValueType &amp;message, const <a class="el" href="classTheron_1_1Address.html">Address</a> from))</td></tr>
<tr class="memdesc:a8b85886531b76f0e6aa9b46004ff6bb0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Checks whether the given message handler is registered with the actor.  <a href="#a8b85886531b76f0e6aa9b46004ff6bb0">More...</a><br/></td></tr>
<tr class="separator:a8b85886531b76f0e6aa9b46004ff6bb0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a752faea0ecbb7f9525c02ed1ef19cbaf"><td class="memTemplParams" colspan="2">template&lt;class ActorType &gt; </td></tr>
<tr class="memitem:a752faea0ecbb7f9525c02ed1ef19cbaf"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classTheron_1_1Actor_a752faea0ecbb7f9525c02ed1ef19cbaf.html#a752faea0ecbb7f9525c02ed1ef19cbaf">SetDefaultHandler</a> (ActorType *const actor, void(ActorType::*handler)(const <a class="el" href="classTheron_1_1Address.html">Address</a> from))</td></tr>
<tr class="memdesc:a752faea0ecbb7f9525c02ed1ef19cbaf"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the default message handler executed for unhandled messages.  <a href="#a752faea0ecbb7f9525c02ed1ef19cbaf">More...</a><br/></td></tr>
<tr class="separator:a752faea0ecbb7f9525c02ed1ef19cbaf"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab8806dfed72869b22d966968340268c3"><td class="memTemplParams" colspan="2">template&lt;class ActorType &gt; </td></tr>
<tr class="memitem:ab8806dfed72869b22d966968340268c3"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classTheron_1_1Actor_ab8806dfed72869b22d966968340268c3.html#ab8806dfed72869b22d966968340268c3">SetDefaultHandler</a> (ActorType *const actor, void(ActorType::*handler)(const void *const data, const <a class="el" href="namespaceTheron_a254da7d1d07833b997828500fbf73daa.html#a254da7d1d07833b997828500fbf73daa">uint32_t</a> size, const <a class="el" href="classTheron_1_1Address.html">Address</a> from))</td></tr>
<tr class="memdesc:ab8806dfed72869b22d966968340268c3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the default message handler executed for unhandled messages.  <a href="#ab8806dfed72869b22d966968340268c3">More...</a><br/></td></tr>
<tr class="separator:ab8806dfed72869b22d966968340268c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a47c64d58a7a683b34101002989d7de0a"><td class="memTemplParams" colspan="2">template&lt;class ValueType &gt; </td></tr>
<tr class="memitem:a47c64d58a7a683b34101002989d7de0a"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classTheron_1_1Actor_a47c64d58a7a683b34101002989d7de0a.html#a47c64d58a7a683b34101002989d7de0a">Send</a> (const ValueType &amp;value, const <a class="el" href="classTheron_1_1Address.html">Address</a> &amp;address) const </td></tr>
<tr class="memdesc:a47c64d58a7a683b34101002989d7de0a"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sends a message to the entity (actor or <a class="el" href="classTheron_1_1Receiver.html" title="A standalone entity that can accept messages sent by actors. ">Receiver</a>) at the given address.  <a href="#a47c64d58a7a683b34101002989d7de0a">More...</a><br/></td></tr>
<tr class="separator:a47c64d58a7a683b34101002989d7de0a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a8ad74c59dded739fd71a66b96bc79ea8"><td class="memTemplParams" colspan="2">template&lt;class ValueType &gt; </td></tr>
<tr class="memitem:a8ad74c59dded739fd71a66b96bc79ea8"><td class="memTemplItemLeft" align="right" valign="top">bool&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classTheron_1_1Actor_a8ad74c59dded739fd71a66b96bc79ea8.html#a8ad74c59dded739fd71a66b96bc79ea8">TailSend</a> (const ValueType &amp;value, const <a class="el" href="classTheron_1_1Address.html">Address</a> &amp;address) const </td></tr>
<tr class="memdesc:a8ad74c59dded739fd71a66b96bc79ea8"><td class="mdescLeft">&#160;</td><td class="mdescRight">Deprecated.  <a href="#a8ad74c59dded739fd71a66b96bc79ea8">More...</a><br/></td></tr>
<tr class="separator:a8ad74c59dded739fd71a66b96bc79ea8"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>The actor baseclass. </p>
<p>All actors in <a class="el" href="namespaceTheron.html" title="Main namespace containing all public API components. ">Theron</a> must derive from this class. It provides the core functionality of an actor, such as the ability to <a class="el" href="classTheron_1_1Actor_a8d5ef774be6470b8a1e8159f93aac07a.html#a8d5ef774be6470b8a1e8159f93aac07a">register message handlers</a> and <a class="el" href="classTheron_1_1Actor_a47c64d58a7a683b34101002989d7de0a.html#a47c64d58a7a683b34101002989d7de0a">send messages</a>, including responding to messages received from other actors. When implementing actors derived from this baseclass, users can call the various protected methods of the baseclass to perform actions like registering message handlers and sending messages.</p>
<p>Although derived actors classes can be constructed directly in user code, they are always associated with an owning <a class="el" href="classTheron_1_1Framework.html">Framework</a> that hosts and executes them. The owning <a class="el" href="classTheron_1_1Framework.html" title="Manager class that hosts, manages, and executes actors. ">Framework</a> is provided to the <a class="el" href="classTheron_1_1Actor.html" title="The actor baseclass. ">Actor</a> baseclass on construction.</p>
<div class="fragment"><div class="line"><span class="keyword">class </span>MyActor : <span class="keyword">public</span> <a class="code" href="classTheron_1_1Actor.html">Theron::Actor</a></div>
<div class="line">{</div>
<div class="line"><span class="keyword">public</span>:</div>
<div class="line"></div>
<div class="line">    MyActor(<a class="code" href="classTheron_1_1Framework.html">Theron::Framework</a> &amp;framework) : Theron::<a class="code" href="classTheron_1_1Actor_a87c458ad24c3429da325ea6f207267f4.html#a87c458ad24c3429da325ea6f207267f4">Actor</a>(framework)</div>
<div class="line">    {</div>
<div class="line">    }</div>
<div class="line">};</div>
</div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>A fundamental principle of the <a class="el" href="classTheron_1_1Actor.html" title="The actor baseclass. ">Actor</a> Model is that actors should communicate only by means of messages, both <a class="el" href="classTheron_1_1Actor_a47c64d58a7a683b34101002989d7de0a.html#a47c64d58a7a683b34101002989d7de0a">sent by themselves</a> and <a class="el" href="classTheron_1_1Actor_a8d5ef774be6470b8a1e8159f93aac07a.html#a8d5ef774be6470b8a1e8159f93aac07a">handled by their message handlers</a>. Since Actors in <a class="el" href="namespaceTheron.html" title="Main namespace containing all public API components. ">Theron</a> are just vanilla C++ classes that derive from the <a class="el" href="classTheron_1_1Actor.html" title="The actor baseclass. ">Actor</a> baseclass, it's possible in practice to add conventional member functions to derived actor classes, breaking the <a class="el" href="classTheron_1_1Actor.html" title="The actor baseclass. ">Actor</a> Model abstraction. However this should be avoided, since it results in ugly code and shared memory issues, reintroducing the need for traditional thread synchronization. Resist the temptation to add a method to an actor class and add a message instead. </dd></dl>
</div></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.5
</small></address>
</body>
</html>
